Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
tonal-note
Advanced tools
tonal-note
is a collection of functions to extract properties from musical notes.
This is part of tonal music theory library.
You can install via npm: npm i --save tonal-note
Read the generated API documentation.
tonal-note
is a collection of functions to get properties from musical notes.
Example
var note = require('tonal-note')
note.name('bb2') // => 'Bb2'
note.chroma('bb2') // => 10
note.enharmonics('C#6') // => [ 'B##5', 'C#6', 'Db6' ]
note.simplify('B#3') // => 'C4'
Integer
String
String
Array
String
Integer
Return the chroma of a note. The chroma is the numeric equivalent to the pitch class, where 0 is C, 1 is C# or Db, 2 is D... 11 is B
Kind: static method of note
Returns: Integer
- the chroma
Param | Type |
---|---|
note | String | Pitch |
Example
['C', 'D', 'E', 'F'].map(_.chroma) // => [0, 2, 4, 5]
_.map(_.chroma, 'cb db eb fb') // => [11, 1, 3, 4]
String
Given a note (as string or as array notation) returns a string with the note name in scientific notation or null if not valid note
Kind: static method of note
Param | Type |
---|---|
n | Pitch | String |
Example
import { noteName } from 'tonal-notes'
['c', 'db3', '2', 'g+', 'gx4'].map(noteName)
// => ['C', 'Db3', null, null, 'G##4']
Example
var tonal = require('tonal')
tonal.noteName('cb2') // => 'Cb2'
tonal.map(tonal.noteName, 'c db3 2 g+ gx4') // => [ 'C', 'Db3', null, null, 'G##4' ]
String
Get pitch class of a note. The note can be a string or a pitch array.
Kind: static method of note
Returns: String
- the pitch class
Param | Type |
---|---|
n | String | Pitch |
Example
tonal.pc('Db3') // => 'Db'
tonal.map(tonal.pc, 'db3 bb6 fx2') // => [ 'Db', 'Bb', 'F##']
Array
Get the enharmonics of a note. It returns an array of three elements: the below enharmonic, the note, and the upper enharmonic
Kind: static method of note
Returns: Array
- an array of pitches ordered by distance to the given one
Param | Type | Description |
---|---|---|
note | String | the note to get the enharmonics from |
Example
var note = require('tonal-note')
note.enharmonics('C') // => ['B#', 'C', 'Dbb']
note.enharmonics('A') // => ['G##', 'A', 'Bbb']
note.enharmonics('C#4') // => ['B##3', 'C#4' 'Db4']
note.enharmonics('Db') // => ['C#', 'Db', 'Ebbb'])
String
Get a simpler enharmonic note name from a note if exists
Kind: static method of note
Returns: String
- the simplfiied note (if not found, return same note)
Param | Type | Description |
---|---|---|
note | String | the note to simplify |
Example
var note = require('tonal-note')
note.simplify('B#3') // => 'C4'
FAQs
Parse and manipulate music notes in scientific notation
The npm package tonal-note receives a total of 140 weekly downloads. As such, tonal-note popularity was classified as not popular.
We found that tonal-note demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.